import java.util.Stack;

/**
 * Created with IntelliJ IDEA.
 * Description:用两个栈实现队列
 * User: wangxin
 * Date: 2024-11-23
 * Time: 21:53
 */
public class test2 {
    Stack<Integer> stack1 = new Stack<Integer>();
    Stack<Integer> stack2 = new Stack<Integer>();

    public void push(int node) {
        if(stack1.isEmpty()&&stack2.isEmpty()){
            stack1.push(node);
            return;
        }
        while(!stack1.isEmpty()){
            stack2.push(stack1.pop());
        }
        stack1.push(node);
        while(!stack2.isEmpty()){
            stack1.push(stack2.pop());
        }

    }

    public int pop() {
        return stack1.pop();
    }
}
